import java.util.Arrays;

public class O66 {
    public static void main(String[] args) {
        O66 o = new O66();
        System.out.println(Arrays.toString(o.constructArr(new int[]{1, 2, 3, 4, 5})));
    }
    public int[] constructArr(int[] a) {
        if (a.length==0)
            return a;
        int[] b = new int[a.length];
        b[0] = a[0];
        for (int i = 1; i < a.length; i++) {
            b[i] = a[i]*b[i-1];
        }
        for (int i = a.length-2; i>=0; i--) {
            a[i] = a[i]*a[i+1];
        }
        int[] re = new int[a.length];
        for (int i = 1; i < b.length-1; i++) {
            re[i] = b[i-1]*a[i+1];
        }
        re[0] = a[1];
        re[b.length-1] = b[b.length-2];
        return re;
    }
}
